<template>
  <div>
    <MyHeader color="#fff" title="购物车案例" background="blue"></MyHeader>
    <div class="main">
      <MyGoods v-for="item in list" :Glist="item" :key="item.id"></MyGoods>
    </div>
    <MyFooter :Flist="list"></MyFooter>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyFooter from "./components/MyFooter";
import MyGoods from "./components/MyGoods";
export default {
  components: {
    MyHeader,
    MyFooter,
    MyGoods,
  },
  data() {
    return {
      list: [],
    };
  },
  async created() {
    const { data: res } = await this.$axios.get("/api/cart");
    this.list = res.list;
    console.log(this.list[0]);
  },
};
</script>

<style>
.main {
  margin: 45px 0 50px;
}
</style>